import rxAjax from '@/assets/js/ajax.js';

//数据源定义管理 api接口
const FormCityApi = {};

FormCityApi.baseUrl= '/api-form/form/core/formCity';
FormCityApi.exportUrl= FormCityApi.baseUrl + '/listExport';

//获取某个分类和页签下的城市数据
FormCityApi.getByCategoryAndCode =function(categoryId,code) {
    var url= FormCityApi.baseUrl + '/getByCategoryAndCode?categoryId=' + categoryId + '&code=' + code;
    return rxAjax.get(url);
}

//保存城市分类树
FormCityApi.save =function(parameter) {
    var url= FormCityApi.baseUrl + '/save';
    return rxAjax.postJson(url,parameter);
}

//根据id删除城市分类
FormCityApi.delById =function(parameter) {
    var url = FormCityApi.baseUrl + '/delById';
    return rxAjax.postUrl(url, parameter);
}

FormCityApi.getByParentId = function (parentId) {
    let params={parentId:parentId};
    var url = FormCityApi.baseUrl + '/getByParentId';
    return rxAjax.postForm(url,params);
}

FormCityApi.getCityCodeByName = function (name) {
    var url = FormCityApi.baseUrl + '/getCityCodeByName?name=' + name;
    return rxAjax.get(url);
}

export  default FormCityApi;

